package com.isoft.controller;

import com.isoft.pojo.vo.overviewVO;
import com.isoft.pojo.vo.statisticsVO;
import com.isoft.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.isoft.service.dashboardService;
import java.util.List;

@RestController
@Slf4j
@Tag(name = "仪表盘接口")
@RequestMapping("/admin/dashboard")
public class dashboardController {
    @Autowired
    private dashboardService dashboardService;

    /**
     * 获取仪表盘顶部数据
     *
     * @return 仪表盘顶部数据
     */
    @GetMapping("/overview")
    @Operation(summary = "获取仪表盘顶部数据")
    public Result<overviewVO> getOverview() {
        log.info("获取仪表盘顶部数据");
        return Result.success(dashboardService.getOverview());
    }

    @GetMapping("/statistics/systemTable")
    @Operation(summary = "获取系统表占比数据")
    public Result<List<statisticsVO>> getStatistics() {
        log.info("获取系统表占比数据");
        return Result.success(dashboardService.getStatistics());
    }

    @GetMapping("/statistics/security")
    @Operation(summary = "获取安全级别数据")
    public Result<List<statisticsVO>> getSecurityStatistics() {
        log.info("获取安全级别数据");
        return Result.success(dashboardService.getSecurityStatistics());
    }
}
